package com.dashu.park.service;


import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Service
public class DataService {

    @Value("${admin.id}")
    public long admin;

    @Resource
    public RestTemplate restTemplate;

    @Autowired
    @PersistenceContext
    EntityManager entityManager;

    @Autowired
    @PersistenceContext(unitName = "tenantPersistenceUnit")//注意引号的内容与配置文件一
     EntityManager entityManagerKq;


    JPAQueryFactory queryFactory;

    JPAQueryFactory queryFactoryKq;

    @PostConstruct
    public void initFactory() {
        queryFactory = new JPAQueryFactory(entityManager);
    }

    @PostConstruct
    public void initFactory1() {
        queryFactoryKq = new JPAQueryFactory(entityManagerKq);
    }




}
